# @Time : 2021/10/26 10:48
# @Author : Li Kunlun
# @Description :join功能测试

# https://blog.csdn.net/nanhuaibeian/article/details/100160953
import threading
import time


def T1_job():
    print('T1 start\n')
    for i in range(10):
        time.sleep(0.1)
    print('T1 finish\n')


# 任务量相对于T1来说较小
def T2_job():
    print('T2 start\n')
    print('T2 finish\n')


def main():
    added_thread = threading.Thread(target=thread_job, name='T1')
    thread2 = threading.Thread(target=T2_job, name='T2')

    # 推荐以这种方式进行排布
    added_thread.start()
    thread2.start()
    thread2.join() # 等待thread2运行完成之后才会运行下面的语句
    added_thread.join()

    print('all done\n')


if __name__ == '__main__':
    main()

"""
可以接收的输出结果(按照顺序进行输出)：
    T1 start
    T2 start
    T2 finish
    T1 finish
    all done
"""
